export const ADD_TABLE_COLUMNS = [
  {
    title: '需求单号',
    key: 'reqNo',
    width: 150
  },
  {
    title: '需求编号',
    key: 'reqDetailNo'
  },
  {
    title: '需求来源',
    key: 'reqSourceStr'
  },
  {
    title: '开发类型',
    key: 'devTypeStr'
  },
  {
    title: '需求日期',
    key: 'reqCreateOpeTime',
    width: 150
  },
  {
    title: '需求发起人',
    key: 'reqSponsorName'
  },
  {
    title: '需求部门',
    key: 'reqSponsorDeptName'
  },
  {
    title: '需求区域',
    key: 'reqSponsorAreaName',
    width: 150
  },
  {
    title: '需求归属中心',
    key: 'belongCenterName'
  },
  {
    title: '开发部门',
    key: 'devDeptName'
  },
  {
    title: '开发负责人',
    key: 'developerName'
  },
  {
    title: '品类编码',
    key: 'categoryNo'
  },
  {
    title: '品类名称',
    key: 'categoryName'
  },
  {
    title: '品类树',
    key: 'categoryPath',
    width: 300
  },
  {
    title: '品牌',
    key: 'brandName'
  },
  {
    title: '商品名称',
    key: 'productName'
  },
  {
    title: '订货数量',
    key: 'orderQuantity'
  },
  {
    title: '订货频次',
    key: 'orderFrequency'
  },
  {
    title: '订货金额',
    key: 'orderAmount'
  },
  {
    title: '预计销量(万元)',
    key: 'expectedSales'
  },
  {
    title: '备注',
    key: 'remark'
  },
]

export const EDIT_TABLE_COLUMNS = [
  ...ADD_TABLE_COLUMNS.filter(column => !['devDeptName', 'developerName'].includes(column.key))
]

export const VIEW_TABLE_COLUMNS = [...EDIT_TABLE_COLUMNS]

export const FINISH_TABLE_COLUMNS = [
  { title: '是否取消', key: 'cancelFlagStr' },
  ...EDIT_TABLE_COLUMNS
]

export const OA_TABLE_COLUMNS = [
  {
    title: '操作状态',
    key: 'operationStatusStr'
  },
  ...EDIT_TABLE_COLUMNS
]

export const FIELDS_ITEMS = [
  { label: '开发计划单号', prop: 'planNo' },
  { label: '计划状态', prop: 'statusStr' },
  { label: '创建日期', prop: 'createOpeTime' },
  { label: '发起人', prop: 'sponsorName' },
  { label: '发起部门', prop: 'sponsorDeptName' },
  { label: '预计销量合计', prop: 'totalExpectedSales' }
]

export const OA_FIELDS_ITEMS = [
  { label: '开发计划单号', prop: 'planNo' },
  { label: '开发计划OA单号', prop: 'recordNo' },
  { label: '单据状态', prop: 'recordStatusStr' },
  { label: '单据类型', prop: 'recordTypeStr' },
  { label: '创建日期', prop: 'createOpeTime' },
  { label: '发起人', prop: 'sponsorName' },
  { label: '发起部门', prop: 'sponsorDeptName' },
  { label: '预计销量合计', prop: 'totalExpectedSales' },
]

// 获取商品明细查看表列
export const getSkuCountCol = eventHandler => ({
  title: '商品明细',
  fixed: 'right',
  render: (h, { row, index }) => {
    if (!row.skuCount) return <span></span>
    return <el-link type="primary" onClick={() => { eventHandler(row, index) }}>{row.skuCount}</el-link>
  }
})
